const paras = document.querySelectorAll("p")

paras.forEach(p =>{
    if(p.textContent.includes('error')){
        p.classList.add("error")
    }
    if(p.textContent.includes('success')){
        p.classList.add("success")
    }
})

//<button onclick="handleClick()">点击</button>

const btn = document.querySelectorAll("button")
btn.onclick = () => { alert('点击') }

const btn = document.querySelectorAll("button")
function handleClick(event) {
    console.log("点击的事件对象：", event)
}

btn.addEventListener('click', handleClick)

const btn = document.querySelectorAll("button")
function handleClick() {
    alert('点击了按钮')
}

btn.addEventListener('click', handleClick)

//解除事件绑定
btn.removeEventListener('click', handleClick);
